package ProxyDemo;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

/**
* @author jie
* @version 创建时间：2018年5月26日 下午4:26:58
* 类说明
*/
public class ProxyInterfaceDemo1 {
	public static void main(String[] args) {
//		(ClassLoader loader,
//                Class<?>[] interfaces,
//                InvocationHandler h)
		RroxyI ss = (RroxyI) Proxy.newProxyInstance(RroxyI.class.getClassLoader(),
				new Class[]{RroxyI.class}, new InvocationHandler() {
					
					@Override
					public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
					
						// If the method is a method from Object then defer to normal invocation.
				        if (method.getDeclaringClass() == Object.class) {
				          return method.invoke(this, args);
				        }
//				        if (platform.isDefaultMethod(method)) {
//				          return platform.invokeDefaultMethod(method, service, proxy, args);
//				        }
//				        ServiceMethod<Object, Object> serviceMethod =
//				            (ServiceMethod<Object, Object>) loadServiceMethod(method);
//				        OkHttpCall<Object> okHttpCall = new OkHttpCall<>(serviceMethod, args);
//				        return serviceMethod.callAdapter.adapt(okHttpCall);
						return null;
					}
				});

		String s = ss.callNum(123);
		System.out.println("result :"+s);

	}

}
